package com.hl.domain;

import lombok.Data;

@Data
public class R {
    private Integer code;//业务状态码 1 成功 0 失败
    private String msg;//提示信息
    private Object data;//返回的数据
    private Object user;//返回的数据

    public static R ok() {
        return new R(200, "success", null,null);
    }

    public static R ok(Object data) {
        return new R(200, "success", data,null);
    }

    public static R error(String msg) {
        return new R(400, msg, null,null);

    }

    public R(Integer code, String msg, Object data, Object user) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.user = user;
    }

    public static R ok(Integer code,String data, String msg,Object user) {
        return new R(200, "msg", data,user);
    }
}
